<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateComponentDefineTable extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('component_define', function (Blueprint $table) {
            $table->bigInteger('id', true);
            $table->string('component_key', 255);
            $table->bigInteger('parent_id')->nullable()->comment('parentId');
            $table->string('parent_key', 255)->nullable()->comment('parent_key');
            $table->string('component_type', 255)->nullable();
            $table->string('display_name', 255)->nullable()->comment('displayName');
            $table->boolean('disabled')->default(false)->comment('1:禁用，0:非禁用');
            $table->string('description', 255)->nullable()->default('');
            $table->json('json_properties')->nullable();
            $table->string('full_class_name', 255)->nullable();
            $table->dateTime('create_time')->useCurrent();
            $table->bigInteger('creator_id')->nullable();
            $table->dateTime('update_time')->useCurrent();
            $table->bigInteger('updater_id')->nullable();
            $table->integer('deleted')->nullable()->default(0);
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('component_define');
    }
};
